<?php $ArPlanos = Dracosys::getSessionValue(SESSION_INTERFACE, 'PlanosList'); ?>
<section id="PlanosList">
    <h2>Listagem de planos</h2>
    <table id="PlanosList_plan" class="list">
        <thead>
            <tr>
                <th>Nome</th>
                <th>Preço</th>
                <th>Status</th>
                <th>Editar</th>
                <th>Desativar / Ativar</th>
                <th>Visualizar</th>
            </tr>
        </thead>
        <tfoot>
        </tfoot>
        <tbody>
            <?php
            if( !empty($ArPlanos) ):
                foreach ($ArPlanos as $Plan):
                    $StDisableLinkStyle = $Plan->isEnable() ? 'style="display:none"' : '';
                    $StEnableLinkStyle = $Plan->isEnable() ?  '' : 'style="display:none"' ;
                ?>
                    <tr>
                        <td><?= $Plan->getStNome() ?></td>
                        <td><?= MathUtils::money(($Plan->getFoPreco())) ?></td>
                        <td>
                            <?= $Plan->getEnStatus() ?>
                        </td>
                        <td>
                            <a href="<?= DRA_URL ?>planos/editar-plano/id/<?= $Plan->getIDPlano() ?>" title="Editar">
                                <img src="<?= DRA_VIEW_URL ?>images/edit.png" alt="Editar" />
                            </a>
                        </td>
                        <td>
                            <a href="<?= DRA_URL ?>planos/desativar-plano/id/<?= $Plan->getIDPlano() ?>" title="desativar" id="PlanosList_disable<?= $Plan->getIDPlano() ?>" <?=$StEnableLinkStyle?> >
                                <img src="<?= DRA_VIEW_URL ?>images/disable.png" alt="desativar" />
                            </a>
                            <a href="<?= DRA_URL ?>planos/ativar-plano/id/<?= $Plan->getIDPlano() ?>" title="ativar" id="PlanosList_enable<?= $Plan->getIDPlano() ?>" <?=$StDisableLinkStyle?>>
                                <img src="<?= DRA_VIEW_URL ?>images/enable.gif" alt="ativar" />
                            </a>
                        </td>
                        <td>
                            <a href="<?= DRA_URL ?>planos/visualizar-plano/id/<?= $Plan->getIDPlano() ?>" title="Visualizar ">
                                <img src="<?= DRA_VIEW_URL ?>/images/descricao.png" alt="Visualizar" />
                            </a>
                        </td>
                    </tr>
            <?php
                endforeach;
            else:
            ?>
                <tr class="nodata">
                    <td colspan="6">
                        Nenhum resultado foi encontrado!
                    </td>
                </tr>
            <?php
            endif;
            ?>
        </tbody>
    </table>
    <div class="insertInList">
        <a href="<?= DRA_URL ?>planos/cadastrar-planos" class="insertIcon">Cadastrar novo plano</a>
    </div>
</section>